package com.ktr.controller;

import com.ktr.entity.KtrType;
import com.ktr.service.KtrTypeService;
import com.bhudy.base.QueryFilter;
import com.sys.utils.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author com.bhudy
 * @Description KtrTypeController
 * @Date 2019-10-30 23:09:37
 */
@RestController
public class KtrTypeController {

    @Autowired
    private KtrTypeService ktrTypeService;

    @GetMapping(value = "/api/v1/ktrTypes")
    public Object getAll() {
        QueryFilter queryFilter = new QueryFilter();
        queryFilter.clear();
        return RequestUtils.printMapJson(0, ktrTypeService.findList(queryFilter));
    }

    @GetMapping(value = "/api/v1/ktrType")
    public Object get(Long ktrId) {
        return RequestUtils.printMapJson(0, ktrTypeService.get(ktrId));
    }

    @PostMapping(value = "/api/v1/ktrType")
    public Object insert(KtrType ktrType) {
        return RequestUtils.printMapJson(0, ktrTypeService.insert(ktrType));
    }

    @PutMapping(value = "/api/v1/ktrType")
    public Object update(KtrType ktrType) {
        return RequestUtils.printMapJson(0, ktrTypeService.update(ktrType));
    }

    @DeleteMapping(value = "/api/v1/ktrType")
    public Object delete(Long[] ktrId) {
        return RequestUtils.printMapJson(0, ktrTypeService.delete(ktrId));
    }

}
